//
//  LTVisitorTableViewController.swift
//  LTWeibo
//
//  Created by mac on 16/6/25.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

class LTVisitorTableViewController: UITableViewController {
    
    var visitorView: LTVisitorView?
    
    var isLogin: Bool = false
    
    override func loadView() {
        
        //代表登录
        if isLogin {
        
            super.loadView()
        
        }else {
        
            settingVisitorView()
            
        }
      
    }
    
    
    func settingVisitorView() {
    
        visitorView = LTVisitorView()
        
        
        //完成闭包,实现跳转
        visitorView?.closure = { [weak self] in
            
            self?.loginBtnClick()
        
          
        
        }
        

        settingNavBar()
        view = visitorView
    
    
    }
    
    
    func settingNavBar() {
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "loginBtnClick")

        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "loginBtnClick")
        
    
    
    }
    
    @objc private func loginBtnClick() {
    
        let oauthVC = LTOauthViewController()
        
        let navVC = UINavigationController(rootViewController: oauthVC)
        
        presentViewController(navVC, animated: true, completion: nil)
        
    
    }
    
    
    
    
    
    
    
    

}
